#!/bin/bash

#author sunbx@funshion.com
#date	2013-10-10
#远程服务器拉回上游服务器最新版本，并更新本地工作区到最新版本

#定义本地git仓库位置
git_repo="/root/workspace/$2"

cd $git_repo

git pull origin $1 

if [ $? -eq 0 ]
then
    echo "#####################"
    echo " PULL SUCCESS!"
    echo "#####################"
else 
    echo "!!!!!!!!!!!!!!!!!!!!!"
    echo "PULL    FAIL!"
    echo "!!!!!!!!!!!!!!!!!!!!!"
fi
git checkout HEAD .
if [ $? -eq 0 ]
then
    echo "#####################"
    echo " CHECKOUT SUCCESS!"
    echo "#####################"
else 
    echo "!!!!!!!!!!!!!!!!!!!!!"
    echo "CHECKOUT  FAIL!"
    echo "!!!!!!!!!!!!!!!!!!!!!"
fi
